package com.maomao.maomaochong_i.quanxing.Adpater;

import com.maomao.maomaochong_i.quanxing.Phone;

import com.maomao.maomaochong_i.quanxing.PhoneData.PhoneData;
import com.maomao.maomaochong_i.global.Show;
import com.maomao.maomaochong_i.quanxing.ShanPingShuJu;
import com.maomao.maomaochong_i.quanxing.Xiugai;
import com.maomao.maomaochong_i.quanxing.YingYong;

import java.util.ArrayList;

/**
 * Created by Mrma on 17.5.19.
 */

public class BrandNewAdapter implements YingYong,Xiugai {

    private Phone Phone;
    private PhoneData PhoneData;

    private static BrandNewAdapter gwc;
    private ArrayList<ShanPingShuJu> getlist;

    public ArrayList<ShanPingShuJu> getGetlist() {
        return getlist;
    }

    public static BrandNewAdapter getOne(Phone quanxingsj){
        if(gwc == null){
            gwc = new BrandNewAdapter(quanxingsj);
        }
        return gwc;
    }

    public static BrandNewAdapter getOne(){
        return gwc;
    }

    private BrandNewAdapter(Phone Phone){
        this.Phone = Phone;
        Phone.tianjia(this);
    }

    @Override
    public void play() {
        PhoneData.classfiy(Show.NEWPHONE);
        getlist = PhoneData.getList();

        System.out.println("新："+getlist.get(0));
    }


    @Override
    public void xiugai(PhoneData PhoneData) {
        this.PhoneData = PhoneData;
        play();
    }
}

